from rest_framework.status import HTTP_400_BAD_REQUEST, HTTP_404_NOT_FOUND

ERROR_AUTOMATION_UNEXPECTED_ERROR = (
    "ERROR_AUTOMATION_UNEXPECTED_ERROR",
    HTTP_400_BAD_REQUEST,
    "{e}",
)

ERROR_AUTOMATION_NODE_REFERENCE_NODE_INVALID = (
    "ERROR_AUTOMATION_NODE_REFERENCE_NODE_INVALID",
    HTTP_400_BAD_REQUEST,
    "{e}",
)

ERROR_AUTOMATION_NODE_DOES_NOT_EXIST = (
    "ERROR_AUTOMATION_NODE_DOES_NOT_EXIST",
    HTTP_404_NOT_FOUND,
    "The requested node does not exist.",
)

ERROR_AUTOMATION_NODE_NOT_IN_WORKFLOW = (
    "ERROR_AUTOMATION_NODE_NOT_IN_WORKFLOW",
    HTTP_400_BAD_REQUEST,
    "The node id {e.node_id} does not belong to the workflow.",
)

ERROR_AUTOMATION_NODE_MISCONFIGURED_SERVICE = (
    "ERROR_AUTOMATION_NODE_MISCONFIGURED_SERVICE",
    HTTP_400_BAD_REQUEST,
    "{e}",
)


ERROR_AUTOMATION_TRIGGER_MUST_BE_FIRST_NODE = (
    "ERROR_AUTOMATION_TRIGGER_MUST_BE_FIRST_NODE",
    HTTP_400_BAD_REQUEST,
    "This operation is disallowed because a trigger must be the first node of "
    "the workflow",
)

ERROR_AUTOMATION_FIRST_NODE_MUST_BE_TRIGGER = (
    "ERROR_AUTOMATION_FIRST_NODE_MUST_BE_TRIGGER",
    HTTP_400_BAD_REQUEST,
    "This operation is disallowed because an action can't be the first node of "
    "the workflow",
)

ERROR_AUTOMATION_TRIGGER_ALREADY_EXISTS = (
    "ERROR_AUTOMATION_TRIGGER_ALREADY_EXISTS",
    HTTP_400_BAD_REQUEST,
    "This workflow already has a trigger",
)

ERROR_AUTOMATION_NODE_NOT_DELETABLE = (
    "ERROR_AUTOMATION_NODE_NOT_DELETABLE",
    HTTP_400_BAD_REQUEST,
    "{e}",
)

ERROR_AUTOMATION_NODE_NOT_REPLACEABLE = (
    "ERROR_AUTOMATION_NODE_NOT_REPLACEABLE",
    HTTP_400_BAD_REQUEST,
    "{e}",
)

ERROR_AUTOMATION_NODE_SIMULATE_DISPATCH = (
    "ERROR_AUTOMATION_NODE_SIMULATE_DISPATCH",
    HTTP_400_BAD_REQUEST,
    "Failed to simulate dispatch: {e}",
)

ERROR_AUTOMATION_NODE_NOT_MOVABLE = (
    "ERROR_AUTOMATION_NODE_NOT_MOVABLE",
    HTTP_400_BAD_REQUEST,
    "{e}",
)
